class A {
  constructor() {
    this.nameA = 'a'
  }

  validateA() {
    console.log('A')
  }
}


class B extends A {
  constructor() {
    super()
    this.nameB = 'b'
  }

  validateB() {
    console.log('B')
  }
}


class C extends B {
  constructor() {
    super()
    this.nameC = 'c'
  }

  validateC() {
    console.log('C')
  }
}


var c = new C()

// 要求返回一个数组，找到类下的面的所有属性和方法

const  members = findMembers(c)

function findMembers(obj) {
  if(obj.__proto__ === null) {
    return []
  }else {
    let names =  Reflect.ownKeys(obj)
    names = names.filter((item) => {
      return item!=='constructor'
    })
    return [...names, ...findMembers(obj.__proto__)]
  }

}


console.log(members)
